﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using eCommerce.core.Helpers;
using eCommerce.core;
using eCommerce.db.DataRespository;
using eCommerce.db.BORespository;

namespace eCommerce.web.Controls.Article
{
    public partial class PostComment : System.Web.UI.UserControl
    {
        protected int ArticleId, TypeId;
         
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ArticleId = Utils.GetIdFromRequestString(Utils.ArticleId, 0);
                Page.RegisterHiddenField("hdArticleId", ArticleId.ToString());
                TypeId = Utils.GetIdFromRequestString(Utils.TypeId, (int)CommentType.Article);
                Page.RegisterHiddenField("hdTypeId", TypeId.ToString());
            }
        }

        protected void btnSend_Click(object sender, EventArgs e)
        {
            /*Id = Utils.GetIdFromRequestString(UtilsB.Id, 0);
            TypeId = Utils.GetIdFromRequestString(Utils.TypeId, (int)CommentType.Article);

            if (Id > 0 && TypeId > 0)
            {
                try
                {
                    var o = new CommentEntity();
                    o.Id = Id;
                    o.ParentId = 0;
                    o.TypeId = TypeId;
                    o.Status = (int)CommentType.IsWaitingForPublish;
                    o.UserName = txtFullName.Value;
                    o.Email = txtEmail.Value;
                    o.Avatar = "/images/user-2.jpg";
                    o.Body = txtBody.Value;

                    CommentBo.Create(o);

                    ltMessage.Text = Utils.ShowMessage(string.Empty, "Bình luận của bạn đã được gửi thành công.", MessageType.Success);
                }
                catch
                {
                    ltMessage.Text = Utils.ShowMessage(string.Empty, "Vui lòng gửi bình luận sau.", MessageType.Information);
                }
            }*/
        }
    }
}